package com.tjs.lucky.infrastructure.mapper;

import com.tjs.lucky.infrastructure.po.StrategyDetail;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * @Author: 田佳澍
 * @Description:
 * @DateTime: 2023/5/16 11:18
 **/
@Mapper
public interface IStrategyDetailMapper {

    /**
     * 查询策略表详细配置
     *
     * @param strategyId 策略ID
     * @return 返回结果
     */
    List<StrategyDetail> queryStrategyDetailListById(Long strategyId);

    /**
     * 查询无库存策略奖品ID
     *
     * @param strategyId 策略ID
     * @return 返回结果
     */
    List<String> queryNoStockStrategyAwardList(Long strategyId);

    /**
     * 扣减库存
     *
     * @param strategyDetailReq 策略ID、奖品ID
     * @return 返回结果
     */
    int deductStock(StrategyDetail strategyDetailReq);

    /**
     * 更新
     * @param strategyDetail
     * @return
     */
    boolean update(StrategyDetail strategyDetail);

    /**
     * 插入策略配置组
     *
     * @param list 策略配置组
     */
    void insertList(List<StrategyDetail> list);

    /**
     * 查询活动下的奖品信息
     *
     * @param strategyId 活动ID
     * @return
     */
    List<StrategyDetail> queryByStrategyId(Long strategyId);

}
